-module(get_users_list).
-export([get_users_by_language/2]).


% Returns a list of [{struct, [{name, "user"}, {level, 4.9}]}] for each user between offset and offset+9 that learns Language
get_users_by_language(Language, Offset) ->
	Number = db_user:get_number_users_by_language(Language),
	Results = db_user:get_users_by_language(Language, Offset, Number),
	L = [ {struct, [{name, atom_to_list(Name)}, {level, hd(io_lib:format("~.2f",[Level]))}]} || {_,_,Name,_,_,_,_,_,_,_,_,_,_,_,_,Level} <- Results],
	{array, [ Number|L]}.
